﻿@{
    ViewBag.Title = "全局债权";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model List<LY.Entity.Entities.T_Project_EX>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link href="~/Content/assets/css/plugin/xjgridnew.css" rel="stylesheet" />
<!--筛选样式 begin-->
<link href="~/Content/assets/plugins/screen/style.css" rel="stylesheet" />
<!--筛选样式 end-->
<link href="~/Content/Claims/Claims.css" rel="stylesheet" />

<div class="change_banner"></div>
<div class="line10"></div>
<div class="container">
    <div class="line10"></div>
    <ul class="select">
        <li class="select-list">
            <dl id="select1">
                <dt>项目状态：</dt>
                <dd class="select-all selected"><a id="status0" aria-valuetext="">全部</a></dd>
                <dd><a id="status1" aria-valuetext="1">待上线</a></dd>
                <dd><a id="status2" aria-valuetext="2">投标中</a></dd>
                <dd><a id="status3" aria-valuetext="3">已满标</a></dd>
                <dd><a id="status4" aria-valuetext="4">还款中</a></dd>
                <dd><a id="status5" aria-valuetext="5">已还款</a></dd>
            </dl>
        </li>
        <li class="select-list">
            <dl id="select2">
                <dt>项目期限：</dt>
                <dd class="select-all selected"><a id="range0" aria-valuetext="">全部</a></dd>
                <dd><a id="range1" aria-valuetext="0,3">3个月以下</a></dd>
                <dd><a id="range2" aria-valuetext="3,6">3 - 6个月</a></dd>
                <dd><a id="range3" aria-valuetext="6,9">6 - 9个月</a></dd>
                <dd><a id="range4" aria-valuetext="9,0">9个月以上</a></dd>
                <dd><a id="range5" aria-valuetext="-1">按天</a></dd>
            </dl>
        </li>
        <li class="select-list">
            <dl id="select3">
                <dt>项目收益：</dt>
                <dd class="select-all selected"><a id="rate0" aria-valuetext="">全部</a></dd>
                <dd><a id="rate1" aria-valuetext="0,5">5%以下</a></dd>
                <dd><a id="rate2" aria-valuetext="5,10">5 - 10%</a></dd>
                <dd><a id="rate3" aria-valuetext="10,15">10 - 15%</a></dd>
                <dd><a id="rate4" aria-valuetext="15,0">15%以上</a></dd>
            </dl>
        </li>
        <li class="select-list">
            <dl id="select4">
                <dt>项目类型：</dt>
                <dd class="select-all selected"><a id="type0" aria-valuetext="">全部</a></dd>
                <dd><a id="type1" aria-valuetext="1">新手项目</a></dd>
                <dd><a id="type2" aria-valuetext="0">非新手项目</a></dd>
            </dl>
        </li>
        <li class="select-result">
            <dl>
                <dt>已选条件：</dt>
                <dd class="select-no">暂时没有选择过滤条件</dd>
            </dl>
        </li>
    </ul>
    <div id="gridlist">
    </div>
    <div class="line10"></div>
</div>

<form id="searchform" method="post">
    <input id="Status" type="hidden" name="Status" />
    <input id="Range" type="hidden" name="Range" />
    <input id="Rate" type="hidden" name="Rate" />
    <input id="Type" type="hidden" name="Type" />
</form>

<script src="~/Content/assets/plugins/xjgrid/xjgrid.js"></script>
<!--筛选js begin-->
<script src="~/Content/assets/plugins/screen/jquery-1.7.2.min.js"></script>
<script src="~/Content/assets/plugins/screen/script.js"></script>
<!--筛选js end-->

<script type="text/javascript">
    var options = [];
    options = {
        listUrl: '@Url.Action("List")'
    };

    $(document).ready(function () {
        var gridopt = {
            url: options.listUrl,
            colModel: [
                { display: '编号', name: 'ID', width: "1%", sortable: true, hide: true, iskey: true },
                {
                    display: '', name: 'ID', width: "10%", sortable: true, align: "center", process: function (value,cell) {
                        if (cell[10] == 1) {
                            return '<img src="/Content/claims/tender_wait.png" width="82" height="75" />';
                        }else if (cell[10] == 2) {
                            return '<img src="/Content/claims/tender.png" width="82" height="75" />';
                        } else if(cell[10]==3){
                            return '<img src="/Content/claims/tender_full.png" width="82" height="75" />';
                        } else if (cell[10] == 4) {
                            return '<img src="/Content/claims/tender_on.png" width="82" height="75" />';
                        } else if (cell[10] == 5) {
                            return '<img src="/Content/claims/tender_over.png" width="82" height="75" />';
                        } else {
                            return '<img src="/Content/claims/tender_end.png" width="82" height="75" />';
                        }
                    }
                },
                {
                    display: '项目名称', name: 'ProjectName', width: "18%", align: "center", sortable: true, process: function (value, cell) {
                        return '<a style="color:gray" href="/Claims/ToInvest/' + cell[0] + '">' + value + '</a>'
                    }
                },
                {
                    display: '项目总额', name: 'TotalLoan', width: "13%", align: "center", sortable: true, process: function (value) {
                        return '￥' + value + ' 元';
                    }
                },
                {
                    display: '年化收益率', name: 'AnnualisedRates', align: "center", width: "8%", sortable: true, process: function (value) {
                        return value + "%";
                    }
                },
                {
                    display: '额外收益率', name: 'AddAnnualisedRates', align: "center", width: "8%", sortable: true, process: function (value) {
                        return value + "%";
                    }
                },
                {
                    display: '项目期限', name: 'ProjectDuration', width: "10%", align: "center", sortable: true, process: function (value, cell) {
                        var tp = cell[9] == 1 ? "个月" : "天";
                        return value + tp;
                    }
                },
                {
                    display: '项目进度', name: 'jindu', width: "20%", sortable: true, process: function (value) {
                        //return '<p style="float:left;max-width:160px;height:30px;margin-top:-5px;background-color:#ff6666;width:' + value * 100 + '%;"></p>' + value * 100 + '%';
                        //return '<div style="float:left;background-color:rgb(207, 191, 191);height:30px;padding:2px;width:160px;"><p style="height:30px;background-color:#ff6666;width:' + value * 100 + '%;"></p></div><div>&nbsp;&nbsp;' + value * 100 + '%</div>';
                        var opp = [];
                        opp.push('<div style="float:left;background-color:#EEEEEE;height:33px;padding:3px;width:155px;">');
                        opp.push('<p style="height:33px;background-color:#ff6666;width:' + value + '%;"></p></div>');
                        opp.push('<div>&nbsp;&nbsp;' + value + '%</div>');
                        return opp.join('');
                    }
                },
                    {
                        display: '操作', name: 'ID', width: "15%", align: "center", sortable: true, process: function (value, cell) {
                            if (cell[10] == 1) {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend' style='background-color:rgb(207, 191, 191);'>即将上线</a>";
                            }
                            else if (cell[10] == 2) {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend'>我要投资</a>"
                            }
                            else if (cell[10] == 3) {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend' style='background-color:rgb(207, 191, 191);'>已经满标</a>";
                            }
                            else if (cell[10] == 4) {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend' style='background-color:rgb(207, 191, 191);'>正在还款</a>"
                            }
                            else if (cell[10] == 5) {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend' style='background-color:rgb(207, 191, 191);'>已经还款</a>"
                            }
                            else {
                                return "<a href='/Claims/ToInvest/" + value + "' class='span_tend' style='background-color:rgb(207, 191, 191);'>筹标结束</a>"
                            }
                        }
                    },
                { display: '月/天', name: 'DurationMonthOrDay', width: "1%", sortable: true, hide: true, align: 'left' },
                { display: '状态', name: 'ProjectStatus', width: "1%", sortable: true, hide: true, align: 'left' },
            ],
            sortname: "ProjectBeginDate",
            sortorder: "DESC",
            title: false,
            rp: 10,
            usepager: true,
            showcheckbox: false
        };

        var xjgrid = new xjGrid("gridlist", gridopt);

        $("#status0,#status1,#status2,#status3,#status4,#status5").click(function () {
            $("#Status").val($(this).attr("aria-valuetext"));
            $("#searchform").submit();
        });
        $("#range0,#range1,#range2,#range3,#range4,#range5").click(function () {
            $("#Range").val($(this).attr("aria-valuetext"));
            $("#searchform").submit();
        });
        $("#rate0,#rate1,#rate2,#rate3,#rate4").click(function () {
            $("#Rate").val($(this).attr("aria-valuetext"));
            $("#searchform").submit();
        });
        $("#type0,#type1,#type2").click(function () {
            $("#Type").val($(this).attr("aria-valuetext"));
            $("#searchform").submit();
        });

        $("#searchform").submit(function () {
            xjgrid.Query(this);
            return false;
        });
    });
</script>



